import serves from './axios'
import store from '@/store/index'

// 文章列表

// 获取文章列表
export function getArticleList() {
    return serves({
        url: '/admin/getArticleList',
        method: 'post',
        data: {
            token: store.state.token
        }
    })
}

// 获取文章详情
export function getArticleInfo(id) {
    return serves({
        url: '/admin/getArticleInfo',
        method: 'post',
        data: {
            token: store.state.token,
            id
        }
    })
}

// 新增文章
export function addArticle(data) {
    return serves({
        url: '/admin/addArticle',
        method: 'post',
        data: {
            token: store.state.token,
            ...data
        }
    })
}

// 删除文章
export function delArticle(id) {
    return serves({
        url: '/admin/delArticle',
        method: 'post',
        data: {
            token: store.state.token,
            id
        }
    })
}

// 修改文章
export function updateArticle(data) {
    return serves({
        url: '/admin/updateArticle',
        method: 'post',
        data: {
            token: store.state.token,
            ...data
        }
    })
}